Computer graphics systems are commonly used for displaying graphical representations of two or three-dimensional objects on a two-dimensional display screen. A conventional computer graphics system includes a host computer for providing instructions and data to a graphics device that includes the display screen. By forwarding commands and data to the graphics device, the host computer controls the display of images on the display screen.
In typical computer graphics systems, an object to be represented on a display screen is broken down into a number of primitives. Primitives are basic components of a graphics picture such as points, lines, vectors and polygons (e.g., triangles). Typically, graphics software executing on the host computer operates in conjunction with the graphics device to render (draw) graphics primitives on the display device.
To render a two or three-dimensional object, the host computer provides a collection of primitive data that collectively defines the object to be rendered. For example, the primitive data that defines a triangle may include the x,y,z coordinates of the three-dimensional object space and the red, green, blue (R,G,B) color values for each vertex of the triangle. Rendering hardware in the graphics device interpolates the primitive data to determine which pixels on the display screen are used to render the triangle, and to determine the red, green and blue color values for each of these pixels.
The process of converting primitive data, e.g., a line, point, or polygon, to a corresponding array of pixel data is known as "scan conversion." The scan conversion process used in a graphics system is invoked quite often, typically thousands of times for each image that is created or modified. Hence, it is desirable to have the scan conversion process execute as rapidly as possible. However, speed of execution often requires some tradeoff against image quality.
Some scan conversion methods are fast, but the primitives that are rendered appear to have jagged edges. The appearance of jagged edges results from a selection of a sub-optimal color for the pixels at the edges of the primitive. Primitives that have jagged edges as a result of their transformation into pixel data are often referred to as "aliased." When a scan converter operates in a mode that does not attempt to correct jagged edges, it is said to be operating in aliased mode.
For example FIG. 1 illustrates a primitive (i.e., triangle 74) that has been rendered by a scan converter operating in aliased mode. When providing a primitive in aliased mode, a fast determination is made as to whether or not each pixel is on (i.e., covered by the primitive), or off (not covered by the primitive). The basic determination is made by evaluating the status of each pixel at an origin point, such as point 1 in FIG. 1. The address, or origin, of each pixel in the x,y coordinate space is defined by the coordinates at the x,y intersections of the grid in the upper right hand corner of the pixel. If the origin point is covered by the primitive, the pixel is on. If not, the pixel is off. Because only a single color sample is taken per pixel, the rendering of the primitive in aliased mode is performed quickly. However, as can be seen in the example of FIG. 1, while aliased primitives may often be rendered quickly, the resulting primitive is often of poor quality.
The process of providing a primitive having the appearance of smoothed edges is commonly referred to as "anti-aliasing." Scan conversion algorithms that operate in anti-aliased mode are generally slower or require significantly more hardware because more calculations are performed at each pixel to select an appropriate color. However, primitives rendered using anti-aliasing have smoother edges as a result of more optimal color selection criteria. One method of anti-aliasing uses multi-point sampling within each pixel to select a more optimal color for pixels at the edges of a primitive. In selecting a more optimal color, multi-point sampling blends the color of the background, including any underlying geometry, with the color of the primitive to smooth jagged edges of the primitive. In multi-point sampling, each pixel is generally sampled at multiple sub-pixel locations within each pixel to determine the portion of the pixel that is covered by the primitive. A single blended color for the pixel is then determined based upon the number of subpixels that are covered by the primitive.
For example, if an edge of a red primitive covers a black background at a given pixel such that 50% of the sub-pixel sample locations are covered, then the color for the pixel may be selected as a mixture of 50% red and 50% black. Thus, by blending the color of the pixels along the edges of a primitive, a smooth transition between the primitive and the background is provided.
One technique used to provide anti-aliased images using multi-point sampling is provided in the REALITYENGINE.TM. graphics device, which is commercially available from Silicon Graphics Computer Systems, U.S.A. The Silicon Graphics device receives plane equations representing primitives, and solves for the individual parameters of each plane equation. The plane equation parameters are used to access a location in a look up table that stores patterns of sub-pixels for each possible combination of parameter values. The pattern of sub-pixels in the lookup table is used to identify the sub-pixels that are covered by the primitive represented by the plane equation at each pixel.
The mathematical calculations used to solve the plane equations are complex. To solve the plane equation parameters at a high performance, many pixel processors are required. Because the mathematical calculations and lookups are performed in hardware, the Silicon Graphics system is capable of providing sub-pixel data relatively quickly. However, a drawback of the above method is that the hardware required to perform the mathematical functions is expensive in terms of gate count, thus increasing the cost and size of the graphics circuitry.
It is an object of the present invention to provide an improved method and apparatus for determining sub-pixel coverage of a primitive for use in anti-aliasing operations.